package chouXiangLeiHeJieKou.ChouXiangLeiHeJieKou2.demo4;

interface IA{
    void testA();
}
interface IB{
    void testB();
}

interface IC extends IB,IA{
    void testC();
}

class D implements IC{
    @Override
    public void testA() {

    }

    @Override
    public void testB() {

    }

    @Override
    public void testC() {

    }
}

public class Test {
    public static void main1(String[] args) {
        Dog dog1=new Dog("旺财",11);
        Dog dog2=new Dog("旺财",11);

        System.out.println(dog1==dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println(dog2.equals(dog1));
        System.out.println("=====");

        //哈希码
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());

    }

    public static void func1(Animal animal){
        animal.eat();
    }

    public static void walk(IRunning iRunning){
        iRunning.run();
    }

    public static void fly(IFly iFly){
        iFly.fly();
    }

    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void main2(String[] args) {
        walk(new Robot());
    }

    public static void main3(String[] args) {
        walk(new Duck("唐老鸭",7));
        walk(new Dog("旺财",11));

        System.out.println("======");
        fly(new Duck("唐老鸭",7));
        System.out.println("=====");
        new Duck("唐老鸭",7).swim();

        swimming(new Duck("唐老鸭",7));
        swimming(new Dog("旺财",11));
        swimming(new Fish("小鱼儿",31));

    }

    public static void main(String[] args) {
        func1(new Duck("唐老鸭",7));
        func1(new Dog("旺财",11));
        func1(new Fish("小鱼儿",31));

    }

}
